import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import i18n, { setI18nLanguage } from './i18n'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './styles/index.scss'
import './plugins'
import * as filters from './utils/filters'
import * as echarts from 'echarts';
import commonFun from './utils/common';
Vue.prototype.commonFun = commonFun;
import Vant from 'vant';
import 'vant/lib/index.css';

Vue.use(Vant);

// 注册全局过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

//导入Analysis目录下自定义组件
import '@/components/echarts/custom.js';

// 使用ElementUI
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})
// 全局方法挂载
Vue.prototype.$echarts = echarts;

Vue.config.productionTip = false

// 创建Vue实例
const app = new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')

// 从store同步语言设置
if (store.getters['settings/language']) {
  setI18nLanguage(store.getters['settings/language'])
}
